package com.zjuh.qss.web.common.pagination;

import java.util.Map;

import wint.lang.magic.MagicClass;
import wint.lang.utils.MapUtil;
import wint.mvc.flow.FlowData;
import wint.mvc.template.Context;

public class PageFacerFactory {
	
	private static Map<String, Class<? extends PageFacer>> pageFacerClassess = MapUtil.newHashMap();
	
	static {
		pageFacerClassess.put("activeTopicItemPageFacer", ActiveTopicItemPageFacer.class);
	}
	
	public static PageFacer getPageFacer(String name, FlowData flowData, Context context) {
		Class<? extends PageFacer> pageFacerClass = pageFacerClassess.get(name);
		MagicClass m = MagicClass.wrap(pageFacerClass);
		PageFacer pageFacer = (PageFacer)m.newInstance().getObject();
		pageFacer.setContext(context);
		pageFacer.setFlowData(flowData);
		return pageFacer;
	}

}
